namespace DataClasses
{
    using System;

    /// <summary>
    /// Connectional class for both album and song
    /// </summary>
    public class AlbumSong : ActiveRecord<AlbumSong>
    {
        /// <summary>
        /// Empty constructor
        /// </summary>
        public AlbumSong() { }
        
        /// <summary>
        /// Simple constructor
        /// </summary>
        /// <param name="al"></param>
        /// <param name="s"></param>
        public AlbumSong(Guid al, Guid s)
        {
            Id = Guid.NewGuid();
            this.IdAlbum = al;
            this.IdSong = s;
            Save();
        }

        public AlbumSong(Guid selfid, Guid al, Guid s)
        {
            Id = selfid;
            this.IdAlbum = al;
            this.IdSong = s;
        }

        /// <summary>
        /// Id of the album
        /// </summary>
        public Guid IdAlbum { get; set; }

        /// <summary>
        /// Id of the song
        /// </summary>
        public Guid IdSong { get; set; }

        public override object[] Objparams
        {
            get
            {
                objects = new object[3];
                objects[0] = Id.ToString();
                objects[1] = this.IdAlbum.ToString();
                objects[2] = this.IdSong.ToString();
                return objects;
            }

            set
            {
                objects = value;
                Id = new Guid(objects[0].ToString());
                this.IdAlbum = new Guid(objects[1].ToString());
                this.IdSong = new Guid(objects[1].ToString());
            }
        }
    }
}
